# Copyright 2024 Ant Group Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@yacl//bazel:yacl.bzl", "yacl_cc_library", "yacl_cc_test")
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension", "pybind_library")

package(default_visibility = ["//visibility:public"])

pybind_library(
    name = "numpy_binding",
    srcs = ["bind_numpy.cc"],
    hdrs = ["bind_numpy.h"],
    defines = ["PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF"],
    deps = [
        ":extension_functions",
        ":infeed",
        ":outfeed",
        ":py_slicer",
        "//heu/library/numpy",
        "//heu/pylib/phe_binding:py_encoders",
    ],
)

pybind_library(
    name = "infeed",
    hdrs = ["infeed.h"],
    deps = [
        "//heu/library/numpy",
        "//heu/pylib/common:traits",
        "//heu/pylib/phe_binding:py_encoders",
    ],
)

pybind_library(
    name = "outfeed",
    hdrs = ["outfeed.h"],
    deps = [
        "//heu/library/numpy",
        "//heu/pylib/common:traits",
        "//heu/pylib/phe_binding:py_encoders",
    ],
)

pybind_library(
    name = "py_slicer",
    srcs = ["py_slicer.cc"],
    hdrs = ["py_slicer.h"],
    deps = [
        "//heu/library/numpy",
        "//heu/pylib/common:traits",
        "//heu/pylib/numpy_binding:slice_tool",
    ],
)

pybind_library(
    name = "slice_tool",
    srcs = ["slice_tool.cc"],
    hdrs = ["slice_tool.h"],
    deps = [
        "//heu/library/numpy",
        "//heu/pylib/common:traits",
    ],
)

pybind_library(
    name = "extension_functions",
    srcs = ["extension_functions.cc"],
    hdrs = ["extension_functions.h"],
    deps = [
        "//heu/library/numpy",
        "//heu/pylib/common:traits",
        "//heu/pylib/numpy_binding:slice_tool",
    ],
)
